<?php

class Bill_Finder_Decorator_Setval extends Bill_Finder_Decorator_Organiz {

	private function _getOrganizeIds($name) {
		
		$tmp = $this->select()->getAdapter()->query("select val from setval where name = '$name'")->fetchAll();
		if (isset($tmp[0]['val'])) return $tmp[0]['val'];
		else return "";
	}
	
	public function prepend ($request) {

		if ($setval = $request['setval']) {
			$request['organiz'] = $this->_getOrganizeIds($setval);
		}
		
		parent::prepend($request);
		return $this;
	}

}